package com.hanhy.Page;

import com.hanhy.util.Log;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import java.util.List;

/**
 * Created by Administrator on 2016/12/12.
 */
public class CreateBidProjectPage extends BasePage{
    public  Log log = new Log(this.getClass());
    public CreateBidProjectPage(WebDriver driver) throws Exception {
        super(driver);
    }
    //页面元素的定位
    //1、项目基本信息
    By projectNameLocator = By.name("projectName");     //项目名称
    By bidResultLocator = By.name("resultOpenType");   //竞价结果
    By projectTypeLocator = By.name("projectType");   //项目类型
    By linkmanLocator = By.name("linkman");  //联系人
    By linkPhoneLocator = By.name("linkphone");  //联系电话
    //2、添加采购品
    //手动添加
    By tjcgpLocator = By.id("tjcgp"); //添加采购品
    By totalPriceLocator= By.name("totalPrice");  //打包采购时的初始价定位
    By planAmountLocator = By.name("planAmount");  //填写采购量
    //选择采购品页面
    By addDirectoryLocator = By.name("addDirectory");//选择采购品

    //上传采购品


    //3、邀请供应商

    //4、填写竞价规则

    //填写竞价项目基本信息,确定建立的采购项目的类型以及竞价方式
    public void fillProjectInfo(String proType){
        WebElement projectName = this.driver.findElement(projectNameLocator);
//        WebElement bidResult = this.driver.findElement(bidResultLocator);
        List<WebElement> bidResult = (List<WebElement>) this.driver.findElement(bidResultLocator);
        WebElement projectType = this.driver.findElement(projectTypeLocator);
        WebElement linkMan = this.driver.findElement(linkmanLocator);
        WebElement linkPhone = this.driver.findElement(linkPhoneLocator);
        //项目名称填写
        if (projectName!=null){
            projectName.sendKeys("selenium项目"+ System.currentTimeMillis());
        }else {
            log.info("项目名称控件无法定位");
        }
        //竞价结果公开选择默认
        //项目类型：打包采购和非打包采购
        if(projectType!=null){

        }



    }


}
